package com.example.day02.m;


import com.example.day02.BaseApp;
import com.example.day02.Bean;
import com.example.day02.p.Persenter;
import com.example.day02.v.CallBack;
import com.example.xts.greendaodemo.db.BeanDao;

import java.util.List;

public class MainModel {
    private final BeanDao beanDao;
    public  MainModel(){
        beanDao = BaseApp.getInstance().getDaoSession().getBeanDao();
}
    public void getData(CallBack callBack) {
        List<Bean> beans = beanDao.loadAll();
        callBack.showBean(beans);
    }

    public void getUpdate(String trim, CallBack callBack) {
        List<Bean> list = beanDao.queryBuilder().whereOr(BeanDao.Properties.Name.like(trim), BeanDao.Properties.Step.like(trim)).list();
        callBack.showBean(list);

    }
}
